package graphic.dialogs;

import java.awt.GridBagConstraints;
import java.awt.GridBagLayout;
import java.awt.Insets;

import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextArea;

public class ReleaseCommitDialog extends AbstractDialog {

	JTextArea note;
	
	boolean committ;
	boolean committVarSet;
	
	public ReleaseCommitDialog()
	{
		super("New Release", "Committ", 300, 200);
	}

	@Override
	public void createPanel() {

		super.setPanel(new JPanel(new GridBagLayout()));		
		JPanel panel = super.getPanel(); 
		
		this.note = new JTextArea(5, 10);
		this.committ = false;
		this.committVarSet = false;
		
		GridBagConstraints c = new GridBagConstraints();
		c.insets = new Insets(5, 10, 5, 10);
		c.fill = GridBagConstraints.BOTH;
		c.anchor = GridBagConstraints.CENTER;
		
		c.gridx = 0;
		c.gridy = 0;
		c.gridwidth = 2;
		panel.add(new JLabel("Release Notes"), c);

		c.gridx = 0;
		c.gridy = 1;
		panel.add(this.note, c);
		
		c.gridx = 0;
		c.gridy = 2;
		c.gridwidth = 1;
		panel.add(super.getOkButton(), c);	
	
		c.gridx = 1;
		c.gridy = 2;
		panel.add(super.getExitButton(), c);	
		
	}

	@Override
	public boolean checkOkFunction() { return true; }

	@Override
	public void okFunction() { this.committ = true; this.committVarSet = true; super.dispose(); }
	
	@Override
	public void exitFunction() { this.committVarSet = true; super.exitFunction(); }
	
	public String getNote() {
		return note.getText();
	}

	public boolean isCommitt() {
		return committ;
	}

	public boolean isCommittVarSet() {
		return committVarSet;
	}
}
